"""
llm 模块
大语言模型相关实现
"""
from src.llm.base_llm import BaseLLM
from src.llm.deepseek_llm import DeepSeekLLM  # 新增DeepSeek导入
from src.llm.huggingface_llm import HuggingFaceLLM
from src.llm.ollama_llm import OllamaLLM

# LLM工厂类（用于根据配置动态创建LLM实例）
class LLMFactory:
    @staticmethod
    def create_llm(config):
        """根据配置创建对应的LLM实例"""
        if config.model_type == "deepseek":
            return DeepSeekLLM(
                model_name_or_path=config.deepseek_model_path,
                device=config.deepseek_device,
                temperature=config.deepseek_temperature,
                max_new_tokens=config.deepseek_max_new_tokens
            )
        elif config.model_type == "huggingface":
            return HuggingFaceLLM(
                model_name_or_path=config.hf_model_path,
                device=config.hf_device,
                temperature=config.hf_temperature,
                max_new_tokens=config.hf_max_new_tokens
            )
        elif config.model_type == "ollama":
            return OllamaLLM(
                model_name=config.ollama_model_name,
                temperature=config.ollama_temperature,
                max_tokens=config.ollama_max_tokens
            )
        else:
            raise ValueError(f"不支持的LLM模型类型: {config.model_type}")
